const GateWayDevice = require ('./GateWayDevice');
const gateWayDevice = new GateWayDevice ();
const process = require ('process');
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
var tslSocket = gateWayDevice.connectToServer ();
tslSocket.on ('secureConnect', function () {
  console.log('gateWayconnect')
  this.write ('{"deviceId":1}');
  // setTimeout (function () {
  //   console.log('i send')
  //   tslSocket.write ('123123');
  // }, 3000);
});
tslSocket.on ('data', function (data) {
  console.log (data.toString ());
});
tslSocket.on('close',function(){
    console.log('byebye')
})
